<div class="pd-20">
	<a class="btn btn-success" onclick="showFood('添加套餐','{:U("Admin/Order/addCombopack")}','4','700','300')">添加1套餐</a>
	<!--
	查看套餐：
        	<select onchange="change(this);" id="state-sel">
	        	<option value="1">进行中套餐</option>
	        	<option value="2">历史套餐</option>
        	</select>
    -->
    <if condition="$cmbpacks eq null">
        <div class="row">
        <if condition="$state eq 1">
        当期没有进行中的套餐, 请前往期数管理中点击"准备"一期!
        <elseif condition="$state eq 2" />
        无往期的套餐, 请前往期数管理中点击"准备"一期!
        </if>
        </div>
        <else />
        <div class="mt-20">
            <table class="table table-border table-bordered table-bg table-sort table-striped">
                <thead>
                    <tr class="text-c">
                    	<th width="10">套餐ID</th>
                        <th width="30">套餐名称</th>
                        <th width="250">所含搭配组合</th>
                        <th width="100">创建时间</th>
                        <th width="150">操作</th>
                    </tr>
                </thead>
                <!--{$vo.postcode}-->
                <tbody>
                    <volist name="cmbpacks" id="vo" key="k">
                        <tr class="text-c">
                        	<td>{$vo.cpid}</td>
                            <td>{$vo.cpname|}</td>
                            <td>{$vo.cp_collocation|json_decode|implode=','}</td>
                            <td>{$vo.createtime|date="y-m-d H:i:s",###}</td>
                            <td><a class="btn btn-success" onclick="showFood('详情','{:U("Admin/Order/addCombopack",array("cpid"=>$vo["id"]))}','4','700',600)">修改</a><a class="btn btn-success" href="{:U('Admin/Order/delOrder', array('oid' => $vo['oid']))}">删除</a></td>
                        </tr>
                    </volist>
                </tbody>
            </table>
        </div>
    </if>
    <div class="row cl dataTables_wrapper">
        {$page}
    </div>
</div>
<script type="text/javascript" src="__PUBLIC__/lib/layer/layer.js"></script>
<script>
function showFood(title, url, id, w, h) {
	console.log('show Food');
    layer_show(title, url, w, h);
}
//用户-编辑
function manage_edit(title, url, id, w, h, pc) {
	var height = 400 + (h-1)*31;
	if(pc == null) {
		height -= 31;
	}
    layer_show(title, url, w, height);
}

function change(obj) {
	//window.location.href="/index.php/Admin/Order/showAll/state/"+$(obj).val();
	window.location.href = "{:U('Admin/Order/showCombopack', array(),false)}"+'/state/'+$(obj).val();
}

$(document).ready(function(){
	var state = {$state};
	$("option").each(function(){
		var opt_val = $(this).val(); 
		if(opt_val == state) {
			$(this).attr("selected",'');
		}
	});
});
</script>
